﻿Imports System.ComponentModel

Public Class COrdenAPICContingencia
    Implements INotifyPropertyChanged

    Private _RollUpCode As String
    Private _Serie As String
    Private _ValueType As String
    Private _RefCurveCode As String
    Private _NumShares As String
    Private _IdFuenteInfo As String
    Private _IdFondo As String
    Private _Saldo As String
    Private _blnEsEditableNuevo As Boolean
    Private _Mensaje As String
    Private _InstNum As Integer

    Private _columnas(7) As Object

    Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

    Private Sub NotificarCambio(ByVal propname As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propname))
    End Sub

    Public Sub New()
        _RollUpCode = ""
        _Serie = ""
        _ValueType = ""
        _RefCurveCode = ""
        _NumShares = "0"
        _IdFuenteInfo = ""
        _IdFondo = ""
        _Saldo = "0.00"
        _blnEsEditableNuevo = False
        _Mensaje = ""

        Columnas(0) = _RollUpCode
        Columnas(1) = _Serie
        Columnas(2) = _ValueType
        Columnas(3) = _RefCurveCode
        Columnas(4) = _NumShares
        Columnas(5) = _IdFuenteInfo
        Columnas(6) = _IdFondo
        Columnas(7) = _Saldo
    End Sub

    Default Property Columnas(ByVal index As Integer) As String
        Get
            Return _columnas(index)
        End Get
        Set(ByVal value As String)

            Try
                Select Case index
                    Case 0
                        Me.RollUpCode = value
                        NotificarCambio("RollUpCode")
                    Case 1
                        Me.Serie = value
                        NotificarCambio("Serie")
                    Case 2
                        Me.ValueType = value
                        NotificarCambio("ValueType")
                    Case 3
                        Me.RefCurveCode = value
                        NotificarCambio("RefCurveCode")
                    Case 4
                        Me.NumShares = value
                        NotificarCambio("NumShares")
                    Case 5
                        Me.IdFuenteInfo = value
                        NotificarCambio("IdFuenteInfo")
                    Case 6
                        Me.IdFondo = value
                        NotificarCambio("IdFondo")
                    Case 7
                        Me.Saldo = value
                        NotificarCambio("Saldo")
                End Select

            Catch ex As Exception
                Throw ex
            End Try

        End Set
    End Property

    Public Shared Function ValorInicalColumna(ByVal index As Integer) As Object
        Select Case index
            Case 0
                Return ""
            Case 1
                Return ""
            Case 2
                Return ""
            Case 3
                Return ""
            Case 4
                Return ""
            Case 5
                Return ""
            Case 6
                Return ""
            Case 7
                Return ""
            Case Else
                Return Nothing
        End Select
    End Function

    Public Shared Function IndexColumna(ByVal campo As String) As Integer
        Select Case campo
            Case "RollUpCode"
                Return 0
            Case "Serie"
                Return 1
            Case "ValueType"
                Return 2
            Case "RefCurveCode"
                Return 3
            Case "NumShares"
                Return 4
            Case "IdFuenteInfo"
                Return 5
            Case "IdFondo"
                Return 6
            Case "Saldo"
                Return 7
            Case Else
                Return Nothing
        End Select
    End Function

    Public Property RollUpCode As String
        Get
            Return _RollUpCode
        End Get
        Set(ByVal value As String)
            _RollUpCode = value
            _columnas(0) = _RollUpCode
            NotificarCambio("RollUpCode")
        End Set
    End Property

    Public Property Serie As String
        Get
            Return _Serie
        End Get
        Set(ByVal value As String)
            _Serie = value
            _columnas(1) = _Serie
            NotificarCambio("Serie")
        End Set
    End Property

    Public Property ValueType As String
        Get
            Return _ValueType
        End Get
        Set(ByVal value As String)
            _ValueType = value
            _columnas(2) = _ValueType
            NotificarCambio("ValueType")
        End Set
    End Property

    Public Property RefCurveCode As String
        Get
            Return _RefCurveCode
        End Get
        Set(ByVal value As String)
            _RefCurveCode = value
            _columnas(3) = _RefCurveCode
            NotificarCambio("RefCurveCode")
        End Set
    End Property

    Public Property NumShares As String
        Get
            Return _NumShares
        End Get
        Set(ByVal value As String)
            _NumShares = value
            _columnas(4) = _NumShares
            NotificarCambio("NumShares")
        End Set
    End Property

    Public Property IdFuenteInfo As String
        Get
            Return _IdFuenteInfo
        End Get
        Set(ByVal value As String)
            _IdFuenteInfo = value
            _columnas(5) = _IdFuenteInfo
            NotificarCambio("IdFuenteInfo")
        End Set
    End Property

    Public Property IdFondo As String
        Get
            Return _IdFondo
        End Get
        Set(ByVal value As String)
            _IdFondo = value
            _columnas(6) = _IdFondo
            NotificarCambio("IdFondo")
        End Set
    End Property

    Public Property Saldo As String
        Get
            Return _Saldo
        End Get
        Set(ByVal value As String)
            _Saldo = value
            _columnas(7) = _Saldo
            NotificarCambio("Saldo")
        End Set
    End Property

    Public Property EsEditableNuevo As Boolean
        Get
            Return _blnEsEditableNuevo
        End Get
        Set(ByVal value As Boolean)
            _blnEsEditableNuevo = value
        End Set
    End Property

    Public Property Mensaje As String
        Get
            Return _Mensaje
        End Get
        Set(ByVal value As String)
            _Mensaje = value
        End Set
    End Property

    Public Property InstNum As Long
        Get
            Return _InstNum
        End Get
        Set(ByVal value As Long)
            _InstNum = value
        End Set
    End Property
End Class
